﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using RFIDStockManagement.Common.Public.InterFace;

namespace RFIDStockManagement.Client.Report
{
    public partial class InventoryReportFilter : DevExpress.XtraEditors.XtraForm, IReportFilter
    {
        private Dictionary<string, object> _parms;
        private bool isGetOk;

        public InventoryReportFilter()
        {
            InitializeComponent();
            _parms = new Dictionary<string, object>();
        }

        private void bntOk_Click(object sender, EventArgs e)
        {
            _parms.Clear();
            _parms.Add("FItemStart", txtItemStart.Text.Trim());
            _parms.Add("FItemEnd", txtItemStart.Text.Trim());
            isGetOk = true;
            this.Hide();
        }

        private void bntCancel_Click(object sender, EventArgs e)
        {
            isGetOk = false;
            this.Hide();
        }

        #region IReportFilter 成员

        public Dictionary<string, object> Filters
        {
            get
            {
                return _parms;
            }
            set
            {
                _parms = value;
            }
        }

        public bool IsGetOk
        {
            get { return isGetOk; }
        }

        public bool Show(string parms)
        {
            if (parms != null)
            {
                object tryObj;
                if (_parms.TryGetValue("FItemStart", out tryObj))
                {
                    txtItemStart.Text = tryObj.ToString();
                }
            }

            this.ShowDialog();

            return isGetOk;
        }

        #endregion
    }
}
